package com.hust.bridgecheck.serviceImpl.UserManagement;

import com.hust.bridgecheck.entity.Domain;
import com.hust.bridgecheck.repository.DomainRepository;
import com.hust.bridgecheck.service.UserManagement.DomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DomainServiceImpl implements DomainService {
    @Autowired
    private DomainRepository domainRepository;
    @Override
    public Domain addDomain(Domain domain){
        return domainRepository.save(domain);
    }
    @Override
    public void deleteDomain(Integer DomainID){
        domainRepository.deleteById(DomainID);
    }
    @Override
    public Domain updateDomain(Domain domain){
        return domainRepository.save(domain);
    }
    @Override
    public List<Domain> getAllDomain(){
        return domainRepository.findAll();
    }
    @Override
    public Domain getDomainByID(Integer DomainID){
        return domainRepository.findById(DomainID).get();
    }
}
